
import apiCreator from '../utils/apiCreator';

const api = apiCreator();

export default {

	// 暴露api上的几个底层方法: get / post
	...api,

	// 获取xx列表
	getList: query => api.post('/test/list', query),
	// 获取实时刷新分析列表
	getRealtimeList: query => api.get('/test/operateList', query),
	getRealtimeList: query => api.get('/ifdata/realtime', query),
	// 获取实例操作流水分析列表
	// getInstanceList: query => api.get('/test/instanceList',query),
	getInstanceList: query => api.get('/ifdata/history', query),
	getCharts: query => api.get('/test/chartInfo', query),
	getChartslist: query => api.get('/test/chartTable', query),
	saveEdit: query => api.post('/test/detail', query),
	onRefresh:query => api.get('/ifdata/iftrade',query),
	// 修改保存xx详情
	saveEdit: query => api.put('/ifdata/history/iftrade', query),
	// 新增
	getAdd: query => api.post('/ifdata/history/iftrade', query),
	// 删除
	removeIntanceRecord: query => api.delete('/ifdata/history/iftrade', query),
	// 登录
	login: query => api.post('/ajaxlogin', query),
	// 登出
	logout: () => api.get('/logout'),
	// 盈亏计算
	profitAndlossAccount: query => api.get('/attribution/indexfuture', query),
	// 图表
	getCharts: query => api.get('/dashboard/kpidata', query),
	getAssetRadarData: query => api.get('/test/chartInfo', query),
	// 获取用户的信息
	queryUser: query => api.get('/user/me', query),

	// 产品仪表盘混合收益
	getMixedEaring: query => api.post('/test/mixedearing', query),

	// dashboard
	getPdtList: query => api.get('/portfolio/list', query),
	getKpiData: query => api.get('/dashboard/kpidata', query),
	getPortfolioratio: query => api.get('/portfolio/portfolioratio', query),

	// fdtAnalysis.investAnalysis
	getFeatureList: query => api.get('/investAnalysis/featureList', query),
	getHistoryFeatures: query => api.get('/investAnalysis/historyFeatures', query),
	getFeaturesMapping: () => api.get('/investAnalysis/featuresMapping'),
	getClosedPositions: query => api.get('/investAnalysis/closedPositions', query),
	getCloseOrder: query => api.get('/investAnalysis/closeOrder', query),
	getAccountDailies: query => api.get('/investAnalysis/accountDailies', query),
	getOpenPositions: query => api.get('/investAnalysis/openPositions', query),
	getSpecialTradings: query => api.get('/investAnalysis/specialTradings', query),
	getCommentConfig: query => api.get('/investAnalysis/commentConfig'),
	getFeatureRanks: query => api.get('/investAnalysis/featureRanks', query),
	getEducationDocs: query => api.get('/investAnalysis/educationDocs', query),
	getCommentClosedPos: query => api.get('/investAnalysis/commentClosedPos', query),

	// fdtAnalysis.retailEducation
	getRetailFeatureList: query => api.get('/retailEducation/featureList', query),
	getRetailHistoryFeatures: query => api.get('/retailEducation/historyFeatures', query),
	getRetailFeaturesMapping: () => api.get('/retailEducation/featuresMapping'),
	getRetailClosedPositions: query => api.get('/retailEducation/closedPositions', query),
	getRetailCloseOrder: query => api.get('/retailEducation/closeOrder', query),
	getRetailAccountDailies: query => api.get('/retailEducation/accountDailies', query),
	getRetailOpenPositions: query => api.get('/retailEducation/openPositions', query),
	getRetailSpecialTradings: query => api.get('/retailEducation/specialTradings', query),
	getRetailCommentConfig: query => api.get('/retailEducation/commentConfig'),
	getRetailFeatureRanks: query => api.get('/retailEducation/featureRanks', query),
	getRetailEducationDocs: query => api.get('/retailEducation/educationDocs', query),
	getRetailHistoryAccountDailies: query => api.get('/retailEducation/historyAccountDailies', query),

	// marketData
	getKlineData: query => api.get('/marketdata/kline', query),
	getKline1min: query => api.get('/marketdata/kline1min', query),
	getTickData: query => api.get('/marketdata/getsecuritytick', query),
	getSimpleDayKline: query => api.get('/marketdata/simpleDayKline', query),
	getSimpleMinKline: query => api.get('/marketdata/simpleMinKline', query),
	getTickKline: query => api.get('/marketdata/tickKline', query),

	// equite
	getBrinsonList: query => api.get('/brinsonResult/find', query),
	getBrinsonPdt: query => api.get('/portfolio/',query),
	getOnePdt:(pdtId,query)=>api.get(`/portfolio/${pdtId}`,query),
	// accountmanagement
	getUsersInfo: query => api.get('/user/', query),
	getUsersAdd: query => api.post('/user/', query),
	saveUsrsEdit: (username,query) => api.put(`/user/${username}`, query),
	getUserpdt: query => api.get('/portfolio/user', query),
	saveUserPermission: (username,query) => api.post(`/portfolio/user?username=${username}`, query),
	removeUserInfo: query => api.delete('/users/saveusers', query),

	//pdtmanagement
	getpdtList: query => api.get(`/portfolio/`, query),//获取产品
	getonelist:(productId,query)=>api.get(`/portfolio/${productId}`,query),
	getPdtPositionList: query => api.get('/portfolio/holdingList',query),
	getPdtTradeList: query => api.get('/portfolio/tradeDetailList',query),
	getfundsList: query => api.get('/portfolio/cashList',query),
	savePdtEdit: (productId,query) => api.put(`/portfolio/${productId}`, query),
	addPdt: query => api.post('/portfolio/', query),
	removePdt: (productId,query) => api.delete(`/portfolio/${productId}`, query),
	//我的资产
	tca:{
		getDailysummary:query => api.get('/tca/dailysummary', query),
		getDailysummaryTarget:query => api.get('/tca/dailysummary/target', query),
		getDailysummaryStrategy:query => api.get('/tca/dailysummary/strategy', query),
		getRealtime:query => api.get('/tca/realtime', query),
		getRealtimeTarget:query => api.get('/tca/realtime/target', query),
		getRealtimeStrategy:query => api.get('/tca/realtime/strategy', query),
	},
	replay:{
		// 获取证投复盘列表数据
		getReplayList:query => api.get('/replay/list', query),
		// 获取证投复盘详情：交易员信息
		getReplayInfo:query => api.get('/replay/info', query),
		// 获取证投复盘详情：股票详情
		getReplayShares:query => api.get('/replay/shares', query),
		// 获取证投复盘详情：交易历史
		getReplayTradeList:query => api.get('/replay/tradeList', query),
		// 获取证投复盘详情：交易详情
		getReplayTradeDetail:query => api.get('/replay/trade', query),
		// 获取交易员定义列表数据
		getTraderDefinitionList:query => api.get('/replay/traderDefinitionList', query),
		// 获取股票定义列表数据
		getStockDefinitionList:query => api.get('/replay/stockDefinitionList', query),
		// 获取团队周期复盘数据
		getTeamSumStat:query => api.get('/replay/teamSumStat', query),
		// 获取交易员指标数据
		getTraderIndex:query => api.get('/replay/traderIndex', query),
		// 获取股票指标数据
		getStockIndex:query => api.get('/replay/stockIndex', query),
		// 获取股票收益数据
		getStockYield:query => api.get('/replay/stockYield', query),
		// 获取交易收益率分布数据
		getTradingYieldDistribution:query => api.get('/replay/tradingYieldDistribution', query),
		// 获取交易时段分布数据
		getTradingTimeDistribution:query => api.get('/replay/tradingTimeDistribution', query),
		//获取交易记录数据
		getTradeRecords:query => api.get('/replay/tradeRecords',query),
		//获取股票表现数据
		getStockPerformance:query => api.get('/replay/stockPerformance',query),
		getStockPerformance2:query => api.get('/replay/stockPerformance',query),
		//获取订单信息数据
		getOrderInfo:query => api.get('/replay/orderInfo',query),
		//获取订单列表数据
		getOrderList:query => api.get('/replay/orderList',query),
		//获取基金列表数据
		getGroupDefinitionList:query => api.get('/replay/groupDefinitionList',query),
		//动态获取交易员股票列表
		getTSDefinitionList:query=>api.get('/replay/TSDefinitionList',query),
		//获取未平仓详情
		getOpenPositionsList:query=>api.get('/replay/openPositions',query),
		
	},
	//专项风险计量
		getVarAnalysis:query => api.get('var/analysis',query),
	//个人设置-信息
		getinfo:query => api.get('/user/me',query),
		saveInfo:query => api.put('/user/update', query),
		//密码
		savepassword:query => api.put('/user/update',query),
	// 基金筛选
	 getListPdt: query => api.get('/portfolio/',query),
	 getFilter: () => api.get('/scheme/'),//获取方案
	 getAllKpiData:() => api.get('/scheme/getAllKpiData'),//获取kpi指标
	 addnewPlan: query => api.post('/scheme/',query),//新增方案名称
	 getSchemekpi: (schemeId,query)  => api.get(`/scheme/${schemeId}`,query),//获取方案指标
	 editSchemekpi:query => api.put('/scheme/',query),//更新方案
	 schemeSelect:(countRange,benchId,beginDate,endDate,query) =>
	 api.post(`/scheme/filterProduct?countRange=${countRange}&benchId=${benchId}&beginDate=${beginDate}&endDate=${endDate}`,query),//筛选方案
	 schemeSelect2:(countRange,benchId,query) =>
	 api.post(`/scheme/filterProduct?countRange=${countRange}&benchId=${benchId}`,query),//筛选方案2
	 pdtSelect:query => api.get('/scheme/filterProduct',query),//产品选择
	 joinAttention:query => api.post('/fundPool/addAttention',query),//加入关注
	 exportfilterData:query => api.post('/fundPool/exportProduct',query),//导出
	//我的关注
	 getPolicyGroup:query => api.get('/fundPool/',query),//查询用户所有基金分组列表
	 addPolicyGroup:query => api.post('/fundPool/',query),//创建基金分组
	 updatePolicyGroup:(groupNumber,query) => api.put(`/fundPool/${groupNumber}`,query),//更新基金分组
	 getGroupDate:(groupNumber,query) => api.get(`/fundPool/${groupNumber}`,query),//查询单个基金分组信息
	 deletePolicyGroup:(groupNumber,query) => api.delete(`/fundPool/${groupNumber}`,query),//删除分组
	 cancelAttention:query => api.post('/fundPool/cancelAttention',query),//取消关注
	 getfilterProduct:(groupNumber,query) => api.get(`/scheme/filterProduct/${groupNumber}`,query),//查询分组中的基金产品

	 scheduling:{
		 // 1.	获取总体执行情况
		 getTotalSummary:query => api.get('/job/getTotalSummary', query),

		 // 2.	获取每个任务执行情况
		 getJobSummary:query => api.get('/job/getJobSummary', query),

		 // 3.	获取每日执行记录
		 getEverydaySummary:query => api.get('/job/getEverydaySummary', query),

		 // 4.	获取每日失败记录
		 getEverydayFails:query => api.get('/job/getEverydayFails', query),

		 // 5.	获取失败详情
		 getFailDetails:query => api.get('/job/getFailDetails', query),

		 // 6.	获取任务基本信息
		 getJobInfo:query => api.get('/job/getJobInfo', query),

		 // 7.	获取任务错误分布
		 getJobErrorDistribute:query => api.get('/job/getJobErrorDistribute', query),

		 // 8.	获取任务执行记录
		 getJobHistory:query => api.get('/job/getJobHistory', query),

		 // 9.	获取任务执行详情
		 getJobReport:query => api.get('/job/getJobReport', query),

		 // 10.	添加用户处理记录
		 addJobHandling:query => api.post('/job/addJobHandling', query),

		 // 11.	获取所有的任务列表
		 getJobList:query => api.get('/job/getJobList', query),

	 },
	 report:{
		 portList:query => api.get('/report/portList', query),
		 getReportParams:query => api.get('/report/performance/getReportParams', query),
	 },
	 retail:{
		 getTraderFeatures:query => api.get('/retailEducation/traderFeatures', query),
		 getCommentClosedPos: query => api.get('/retailEducation/commentClosedPos', query),
		 getSimpleEducationDocs: query => api.get('/retailEducation/simpleEducationDocs', query),
		 putArticleFeed: query => api.post('/retailEducation/ArticleFeedCollect', query),
		 getRecommendationsAll: query => api.get('/recommendations/services/all', query),
     putFeedback: {
        upvoted: (educationId, traderId, query) => api.put(`/recommendations/feedback/services/education/docs/${educationId}/upvoted/traders/${traderId}`, query),
        downvoted: (educationId, traderId, query) => api.put(`/recommendations/feedback/services/education/docs/${educationId}/downvoted/traders/${traderId}`, query),
        saved: (educationId, traderId, query) => api.put(`/recommendations/feedback/services/education/docs/${educationId}/saved/traders/${traderId}`, query),
     },
     deleteFeedback: {
        upvoted: (educationId, traderId, query) => api.delete(`/recommendations/feedback/services/education/docs/${educationId}/upvoted/traders/${traderId}`, query),
        downvoted: (educationId, traderId, query) => api.delete(`/recommendations/feedback/services/education/docs/${educationId}/downvoted/traders/${traderId}`, query),
        saved: (educationId, traderId, query) => api.delete(`/recommendations/feedback/services/education/docs/${educationId}/saved/traders/${traderId}`, query),
     },
     getRetailEducationDetail: (educationId, query) => api.get(`/recommendations/services/education/docs/${educationId}`, query),
     getFdtScore:query => api.get('/retailEducation/evaluation/fdtScore', query),
     getProfitability:query => api.get('/retailEducation/evaluation/profitability', query),
     getRiskControl:query => api.get('/retailEducation/evaluation/riskControl', query),
     getActivity:query => api.get('/retailEducation/evaluation/activity', query),
     getConsistency:query => api.get('/retailEducation/evaluation/consistency', query),
	 },
	 netValue:{
		// 获取最新净值数据
		getLatestNetValue:query => api.get('/portfolio/netValue/latest',query),
		// 获取实时净值数据
		getRealTimeNetValue:query => api.get('/portfolio/netValue/realTime',query),
		// 获取净值走势数据
		getNetValueTrend:query => api.get('/portfolio/netValue/trend',query),
		// 获取净值表现数据
		getNetValuePerformance:query => api.get('/portfolio/netValue/performance',query),
		// 获取月度回报数据
		getMonthlyReturn:query => api.get('/portfolio/netValue/monthlyReturn',query),
	 },
	 //持仓分析
	 position:{
		// 持仓分析初始化时间
		getPositionInit:query => api.get('/portfolio/position/initDate',query),
		//获取组合资产数据
		getPortfolioAssets:query => api.get('/portfolio/position/portfolioAssets',query),
		//获取类别资产数据
		getCategoryAssets:query => api.get('/portfolio/position/categoryAssets',query),
		//获取行业分布数据
		getIndustryDistribution:query => api.get('/portfolio/position/industryDistribution',query),
		//获取仓位走势数据
		getPositionTrend:query => api.get('/portfolio/position/trend',query),
		//获取前十大重仓股票数据
		getTopTenStocks:query => api.get('/portfolio/position/topTenStocks',query)
	 },
	 performanceAttribution:{
		getStockTop:query => api.get('/portfolio/performanceAttribution/stock',query),
		getBrinson:query => api.get('/portfolio/performanceAttribution/brinson',query),
	 },
	//  穿透
	 through:{
		//获取股票持仓数据
		getStockHolding:query => api.get('/portfolio/position/stock',query),
		//获取债券持仓数据
		getBondHolding:query => api.get('/portfolio/position/bond',query),
		//获取基金持仓数据
		getFundHolding:query => api.get('/portfolio/position/fund',query),
		//获取现金持仓数据
		getCashHolding:query => api.get('/portfolio/position/cash',query),
		//获取衍生品持仓数据
		getDerivativesHolding:query => api.get('/portfolio/position/derivatives',query),
		//获取其他持仓数据
		getOtherHolding:query => api.get('/portfolio/position/other',query),
	 },
	 //  风险
	 risk:{
		//获取变现数据汇总数据
		getRealisationSummary:query => api.get('/portfolio/risk/realisationSummary',query),
		//获取变现数据列表数据
		getRealisationList:query => api.get('/portfolio/risk/realisationList',query),
	 },
	 // 风格
	 style:{
		//获取风格研究列表数据
		getStyleResearchList:query => api.get('/portfolio/style/researchList',query),
		//获取净值管理人风格箱数据
		getNetValueManagerStyleBox:query => api.get('/portfolio/style/netValueManagerStyleBox',query),
		//获取净值滚动风格配置图数据
		getNetValueRollingStyleConfig:query => api.get('/portfolio/style/netValueRollingStyleConfig',query),
		//获取管理人风格列表数据
		getManagerStyleBoxList:query => api.get('/portfolio/style/managerStyleBoxList',query),
		//获取管理人风格图表数据
		getManagerStyleBoxCharts:query => api.get('/portfolio/style/managerStyleBoxCharts',query),
		//获取各风格回报和估值数据
		getReturnValuation:query => api.get('/portfolio/style/returnValuation',query),
	 },
	 //获取研究列表数据
	 getResearchList:query => api.get('/researchReport/list',query),
	 //获取研究详情数据
	 getResearchDetail:query => api.get('/researchReport/details',query),

	 
	 //资产配置模拟
	construction:{
		getConfigureScheme:query=>api.get('/assetstrategy/',query),//配置方案构建表格
		addConfigureScheme:query=>api.post('/assetstrategy/',query),//新增配置方案
		deleteScheme:(strategyId,query) => api.delete(`/assetstrategy/${strategyId}`,query),//删除配置方案
		updateScheme:(strategyId,query) => api.put(`/assetstrategy/${strategyId}`,query),//更新配置方案
		getOneConfigureScheme:query=>api.get(`/assetstrategy/findOne`,query),
		getLargeAsset:query=>api.get('/asset/',query),//获取所有大类资产名称
		getPdtList:query=>api.get('/portfolio/',query),//获取资产指数(基金)
		getConfigKpis:query=>api.get('/portfolio/kpi',query),//获取产品收益的相关系数
		getAssetRatio:query=>api.get('/assetstrategy/assetsRatio',query),//各类资产的相关系数
	},
	 role:{
		 // 获取所有角色
		 getRoles:query => api.get('/role/', query),
		 // 获取所有菜单
		 getTheRoleMenus:query => api.get('/menu/', query),
		 // 给角色分配菜单
		 setupTheRoleMenu:query => api.post('/role/assignmenu', query),

	 },
	//私募管理人
	privateMgt:{
		getsmmcAlxr:query => api.get('/fundcorp/', query),// 查询产品管理人
		addPdtManager:query => api.post('/fundcorp/', query),// 创建产品管理人
		deleteManager:(id,query) => api.delete(`/fundcorp/${id}`,query),//删除产品管理人
		editPdtManager:query => api.put('/fundcorp/',query),//更新产品管理人
		addPdt:query => api.post('/portfolio/',query),//新增私募产品

		getPrivatePdt:query => api.get('/fundcorp/product',query),//获取私募产品
		addPrivatePdt:query => api.post('/fundcorp/product',query),//新增私募产品
		deletePrivatePdt:(productId,query) => api.delete(`/fundcorp/product/${productId}`,query),//删除产品
		editPrivatPdt:(productId,query) => api.put(`/fundcorp/product/${productId}`,query),//更新产品
		
		fundCompetition:query => api.get('/fundcompetition/',query),//获取比赛列表
		addfundCompetition:query => api.post('/fundcompetition/',query),//新增比赛
		editfundCompetition:(id,query) => api.put(`/fundcompetition/${id}`,query),//更新私募比赛
		deletefundCompetition:(id,query) => api.delete(`/fundcompetition/${id}`,query),//删除私募比赛
		getGameDetails:(id,query) => api.get(`/fundcompetition/${id}`,query),//获取比赛详情
		getDepartment:query=> api.get('/department/',query),//获取所有部门
		createDivision:query=>api.post('/fundcompetition/division',query),//创建赛区
		editDivision:(id,query)=>api.put(`/fundcompetition/division/${id}`,query),//修改赛区
		deleteDivision:(id,query)=>api.delete(`/fundcompetition/division/${id}`,query),//删除赛区
		getEnrollGame:(id,query)=> api.get(`/fundcompetition/${id}/enroll`,query),//获取报名详情 
		deletEnrollePdt:(competitionId,id,query)=> api.delete(`/fundcompetition/enroll/${competitionId}?id=${id}`,query),//删除报名产品
		gameSignUp:(competitionId,query)=>api.post(`/fundcompetition/enroll/${competitionId}`,query),//报名
		gamePublish:query =>api.get('/fundcompetition/publish',query),//发布
		stopEntrollProduct:query => api.get('/fundcompetition/stopEntrollProduct',query),//产品禁使用
		getRankingsTable:(competitionId,query)=>api.get(`/fundcompetition/rank/${competitionId}`,query),//排名
		getPdtdepartment:query=>api.get('/fundcompetition/department',query)//获取产品下属部门
	},
	//基准管理
	benchmarkMgt:{
		getBenchmarks:query => api.get('/benchmark/getBenchmarks',query),//获取基准列表
		addBenchmark:query => api.post('/benchmark/',query),//新增复合基准
		getBenchmark:query => api.get('/benchmark/',query),//查询基准(包含复合)
		deleteBenchmark:(benchId,query) => api.delete(`/benchmark/${benchId}`,query),//删除复合基准
		editBenchmark:query => api.put('/benchmark/',query),//编辑复合基准
	},
	// fundReport
getfundReportList: query => api.get('/report/performance/getReportsByTimeRange', query),

};
